<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="common/include :: header('客户列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <!--搜索框-->
    <div class="col-sm-12 search-collapse"></div>
    <!--工具栏-->
    <div class="btn-group-sm" id="toolbar" role="group">
        <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:customer:add">
            <i class="fa fa-plus"></i> 新增
        </a>
    </div>
    <!--数据表格-->
    <div class="col-sm-12 select-table table-striped">
        <table id="bootstrap-table"></table>
    </div>
</div>
<th:block th:include="common/include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "/system/customer";
    $(function () {
        var options = {
            url: prefix + "/query",
            createUrl: prefix + "/addPage",
            updateUrl: prefix + "/editPage?id={id}",
            removeUrl: prefix + "/remove",
            modalName: "客户",
            columns: [{
                field: 'id',
                title: '客户id',
                //visible: false
            }, {
                field: 'name',
                title: '客户名称',
            }, {
                field: 'phone',
                title: '客户手机',
            }, {
                field: 'age',
                title: '客户年龄',
            }, {
                title: '操作',
                align: 'center',
                formatter: function (value, row, index) {
                    var actions = [];
                    actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" ' +
                        'onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                    actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)"' +
                        ' onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                    return actions.join('');
                }
            }
            ]
        }
        $.table.init(options);
    });
</script>
</body>
</html>